package com.chance.cc.crawler.development.bootstrap.wangyiyun;

import com.alibaba.fastjson.JSONObject;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class WangyiyunCheck {
    public static void main(String[] args) {
        String path = "D:\\chance\\log\\logs.txt";
        String filePath = "D:\\chance\\log\\wangyiyun.log";
        File readFile = new File(path);
        File writeFile = new File(filePath);
        List<String> arrayList = new ArrayList<>();
        try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(readFile), "UTF-8"));
            String id = null;
            while ((id = bufferedReader.readLine()) != null){
                arrayList.add(id);
            }
            BufferedReader bufferedReader1 = new BufferedReader(new InputStreamReader(new FileInputStream(writeFile), "UTF-8"));

            String s = null;
            int line = 0;
            while ((s = bufferedReader1.readLine()) != null){
                JSONObject jsonObject = JSONObject.parseObject(s);
                String dataId = jsonObject.getString("dataId");
                String[] split = dataId.split("-");
                if(arrayList.contains(split[split.length - 1])) {
                    arrayList.remove(split[split.length - 1]);
                }
            }

            for (String s1 : arrayList) {
                System.out.println(s1);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
